<div class="layui-fluid nepadmin-pad0 nepadmin-mar0 list0" id="list" lay-title="设备异常管理">
	<div class="layui-fluid">
		<div class="layui-row layui-col-space15">
			<div class="layui-col-md12">
				<div class="layui-card hxr-layui-card" id="userlistv">
					<div class="layui-form layui-card-header hxradmin-card-header">
						<div class="layui-form-item">
							<div class="layui-inline">
								<label class="layui-form-label">关键词查询</label>
								<div class="layui-input-inline">
									<input type="text" name="user" placeholder="会员名称/设备名称/设备编号" class="layui-input" autocomplete="off">
								</div>
							</div>
							<div class="layui-inline">
								<button class="layui-btn" data-type="reload" id="search">搜索</button>
							</div>
							<div class="layui-inline">
								<button class="layui-btn" data-type="excel" id="pexcel">导出数据</button>
							</div>
						</div>
					</div>
					<div class="layui-card-body">
						<table class="layui-hide" id="list-table" lay-filter="list-table"></table>
						<script type="text/html" id="status">
						  {{#  if(d.status === 1){ }}
							<span class="layui-badge">报警中</span>
						  {{#  } else if(d.status === 2) { }}
						    <span class="layui-badge layui-bg-blue">正在处理</span>
							{{#  } else if(d.status === 3) { }}
							  <span class="layui-badge layui-bg-green">已处理</span>
						  {{#  } }}
						</script>
						<script type="text/html" id="list-address">
						    {{d.school_name}}-{{d.institute_name}}-{{d.majors_name}}-{{d.grade_name}}-{{d.class_name}}班-{{d.dormitory_name}}-{{d.tung_name}}-{{d.room_name}}
						</script>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/html" id="device_m">
	{{ d.device_name }}--{{d.device_sn}}
</script>
<script>
	//表格数据渲染
	layui.use(['table', 'form','laydate'], function() {
		var table = layui.table,
			form = layui.form,
			$ = layui.$;
			layui.admin.initlist(table,'device/abnormal_log_list',240,[
						[{
							field: 'device_abnormal_id',
							title: 'ID',
							width: 60
						},{
							field: 'member_name',
							title: '申请人',
							minWidth: 100
						}, {
							field: 'device_name',
							title: '设备',
							minWidth: 300,
							templet:'#device_m'
						}, {
							field: 'agent_name',
							title: '代理商',
							minWidth: 100
						}, {
							field: 'tel',
							title: '申请人电话',
							width: 150
						},{
							field: 'school',
							title: '地址',
							minWidth: 450,
							templet:'#list-address'
						}, {
							field: 'status',
							title: '申请状态',
							width: 100,
							templet:'#status'
						},{
							field: 'create_time',
							title: '申请时间',
							width: 180
						},{
							field: 'handle_time',
							title: '处理时间',
							width: 180
						},{
							field: 'end_time',
							title: '完结时间',
							width: 180
						}]
					])

		//搜索
		$('#search').on('click', function() {
			var obj=$(this).parents('.layui-form-item');
			var val1 = obj.find('input[name="user"]').val();
			layui.admin.reloads({
				search_text:val1
			});
		});
		//导出
		$('#pexcel').on('click', function() {
			var obj=$(this).parents('.layui-form-item');
			var val1 = obj.find('input[name="user"]').val();
			layui.admin.excel(table,'device/abnormal_log_list',
					{
						search_text:val1
					},'');
		});
	});
</script>
